﻿using System;
using System.Linq;
using Rabbit.Logic;

namespace RabbitManage.Action
{
    public partial class ShopValidate : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string name = Request["NickName"];
            if (!string.IsNullOrEmpty(name))
            {
                IQueryable<Shop> list = RabbitUse.GetShopByNickName(Db.Store, name);
                if (list.Any())
                {
                    Response.Write("false");
                    return;
                }
                Response.Write("true");
            }

            string cellPhone = Request["CellPhone"];
            if (!string.IsNullOrEmpty(cellPhone))
            {
                IQueryable<ShopIdentity> list = RabbitUse.GetShopIdentityByCellPhone(Db.Store, cellPhone);
                if (list.Any())
                {
                    Response.Write("false");
                    return;
                }
                Response.Write("true");
            }
            string mail = Request["Mail"];
            if (!string.IsNullOrEmpty(mail))
            {
                IQueryable<ShopIdentity> list = RabbitUse.GetShopIdentityByMail(Db.Store, mail);
                if (list.Any())
                {
                    Response.Write("false");
                    return;
                }
                Response.Write("true");
            }
        }
    }
}